import vue from 'vue';

import countDown from './countDown.vue';

const countDownConstructor = vue.extend(countDown);

function showCountDown(time, options = {}) {
    const _countDown = new countDownConstructor({
        data() {
            return {
                time,
                options
            };
        }
    });
    const element = _countDown.$mount().$el;
    document.body.appendChild(element);
}

showCountDown.install = (Vue) => {
    Vue.prototype.$countDown = showCountDown;
};

export default showCountDown;
